export class RunOnlyFirst {
    canRun = true;
    fun:any = null;
    constructor(fun:Function){
        this.fun = fun;
    };
    run(){
        if(this.canRun){
            console.log(this)
            console.log('zhixing')
            this.canRun=false
            return this.fun()
        }
    };
}
export const getNowTimeMs = ():number=>{
    return new Date().getTime()
}
const digitsObj:{[zeroCounts:string]:string} = {
    10:'十',
    100:'百',
    1000:'千',
    10000:'万',
    100000:'十万',
    1000000:'百万'
}
export const numberFormat = (para:number|string,changeNumber:number = 10000):string=>{
    let num = Number(para)
    let str = digitsObj[`${changeNumber}`]
    if(num > changeNumber 
        && str){
        return `${Math.floor(num/changeNumber)}${str}`
    }
    return `${num}`
}